package com.bot.nft.core.config;

import com.bot.nft.module.mb.domain.vo.MbUserInfoVo;
import net.jodah.expiringmap.ExpirationPolicy;
import net.jodah.expiringmap.ExpiringMap;

import java.util.concurrent.TimeUnit;

/**
 * 手机号验证码验证
 */
public class LoginStorage {

    //验证map
    private static ExpiringMap<String, Integer> map;

    //会员登录map
    private static ExpiringMap<String, MbUserInfoVo> userMap;

    static {
        map = ExpiringMap.builder()
                .variableExpiration().expirationPolicy(ExpirationPolicy.CREATED).build();
        userMap = ExpiringMap.builder().expiration(3, TimeUnit.DAYS)
                .variableExpiration().expirationPolicy(ExpirationPolicy.CREATED).build();
    }

    private LoginStorage() {

    }

    public static ExpiringMap<String, Integer> getExpiringMap() {
        return map;
    }

    public static ExpiringMap<String, MbUserInfoVo> getUserMap() {
        return userMap;
    }
}
